import React from "react";
import Qwer from "./components/qwer/qwer";

class App2 extends React.Component {
  state = {
    count: 100,
  };
  addCount() {
    const { count } = this.state;
    // 唯一修改数据的方案
    this.setState({
      // 数量 +1
      count: count + 1,
    });
  }
  render() {
    const { count } = this.state;
    return (
      <div>
        <h1>App2 </h1>
        <h2>count : {count}</h2>
        <button onClick={() => this.addCount()}>+1</button>
        <hr />

        <Qwer count={count} addCount={() => this.addCount()}></Qwer>
      </div>
    );
  }
}

export default App2;
